package com.cuoyi.coupon.mall.controller;

import com.cuoyi.coupon.mall.common.ApiResult;
import com.cuoyi.coupon.mall.common.Entry;
import com.cuoyi.coupon.mall.model.req.TransCodeAddReq;
import com.cuoyi.coupon.mall.model.req.TransCodePageReq;
import com.cuoyi.coupon.mall.model.res.TransCodePageResp;
import com.cuoyi.coupon.mall.service.TransCodeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 转码
 *
 * @author zhang.cheng
 * 2022-02-25 20:57
 **/
@RestController
@Api(value = "转码接口", tags = "转码接口")
@RequestMapping(value = Entry.ADMIN + "/transcode")
public class TransCodeController {

    @Resource
    private TransCodeService transCodeService;

    @PostMapping(value = "/saveTransCode")
    @ApiOperation(value = "转码保存", notes = "转码保存")
    public ApiResult saveTransCode(@Valid @RequestBody TransCodeAddReq transCodeAddReq) {
        transCodeService.save(transCodeAddReq);
        return ApiResult.ok();
    }

    @PostMapping(value = "/getPageTransCode")
    @ApiOperation(value = "获取转码分页数据", notes = "获取转码分页数据")
    public ApiResult<TransCodePageResp> getPageTransCode(@RequestBody TransCodePageReq transCodeAddReq) {
        return ApiResult.ok(transCodeService.getPageTransCode(transCodeAddReq));
    }


}
